<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Message extends Model
{
    protected  $table='user_message';

    protected $fillable = [
        'from_user_id',
        'to_user_id',
        'title',
        'type',
        'content',
        'publish_time',
        'is_read'
    ];

    public function from() {
        return $this->belongsTo('App\User', 'from_user_id', 'id');
    }

    public function to() {
        return $this->belongsTo('App\User', 'to_user_id', 'id');
    }
}
